package FacadePattern.Program4;

import com.sun.tools.javac.Main;

public class Client {
    public static void main(String[] args) {
        Mainframe mainframe = new Mainframe();
        System.out.println("Computer On-----");
        mainframe.on();
        System.out.println("Computer Off----");
        mainframe.off();
    }
}

class Mainframe {
    private Memory memory;
    private CPU cpu;
    private HardDisk hardDisk;
    private OS os;

    public Mainframe() {
        memory = new Memory();
        cpu = new CPU();
        hardDisk = new HardDisk();
        os = new OS();
    }

    void on() {
        memory.check();
        cpu.run();
        hardDisk.read();
        os.load();
    }

    void off() {
        memory.off();
        cpu.off();
        hardDisk.off();
        os.off();
    }
}

class Memory {
    void check() {
        System.out.println("内存自检");
    }
    void off() {
        System.out.println("Memory is off");
    }
}
class CPU {
    void run() {
        System.out.println("Cpu Run");
    }
    void off() {
        System.out.println("Cpu is off");
    }
}

class HardDisk {
    void read() {
        System.out.println("硬盘读取");
    }
    void off() {
        System.out.println("HardDisk is off");
    }
}
class OS {
    void load() {
        System.out.println("载入操作系统");
    }
    void off() {
        System.out.println("Os is off");
    }
}